package com.jin.dao;

import javax.annotation.Resource;
import javax.jms.JMSException;
import javax.jms.Session;

import org.springframework.context.annotation.Scope;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Component;

import com.jin.entity.impl.User;

@Component("userDao")
@Scope("prototype")
public class UserDao  extends HibernateDaoSupport {
    @Resource
	User user;
    Session session=(Session) this.getHibernateTemplate();
    
    public boolean addUser(User user) {
    	boolean isto = false;
		try {
			isto = session.getTransacted();
			if(isto ){
	    		this.getHibernateTemplate().save(user);
	    		session.close();
	    	}
	    	session.close();
	    	return false;
		} catch (JMSException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return isto;
    	
    }
    
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
}

